package group2.service.impl;

import group2.mapper.ShoppingCarMapper;
import group2.model.Book;
import group2.model.BooksCar;
import group2.service.IShoppingCarService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import java.util.List;

@Service("shoppingCarService")
public class ShoppingCarServiceImpl implements IShoppingCarService {
@Autowired
    ShoppingCarMapper shoppingCarMapper;


    @Override
    public List<BooksCar> findCarInfo(String user_id) {
        return shoppingCarMapper.findCarInfo(user_id);
    }



    @Override
    public BooksCar selectShoppingCarId(Integer book_id,String user_id) {
        return shoppingCarMapper.findShopCarId(book_id,user_id);
    }

    @Override
    public int insertShopCar(Integer book_id, String user_id) {
        return shoppingCarMapper.insertShopCar(book_id,user_id);
    }

    @Override
    public int addShopCarBook(Integer book_id, String user_id) {
        return shoppingCarMapper.addShopCarBook(book_id,user_id);
    }

    @Override
    public int removeShopCar(Integer book_id, String user_id) {
        return shoppingCarMapper.removeShopCar(book_id,user_id);
    }

    @Override
    public int deleteShopCar(Integer book_id, String user_id) {
        return shoppingCarMapper.deleteShopCar(book_id,user_id);
    }

    @Override
    public int deleteAll(String user_id) {
        return shoppingCarMapper.deleteAllById(user_id);
    }
}
